<template>
    <view>
        <!-- #ifdef MP-WEIXIN --> 
        <top-nav :inner-title="title" is-show-back="true" is-fixed="true" :navH="navH" :n="n" is-white="bg-white" opacity="1" :navBack='2'></top-nav>
        <view :style="{height:navH + 'px'}"></view>
        <!-- #endif -->
        <view class="dark_text flex item_1">
            <icon class="gray-ck-icon checked"></icon>
            <text>评价完成</text>
        </view>
        <view class="item flex column">
            <view class="flex slide_title">
                <view class="slide"></view>
                <view class="light_text flex">我的评价</view>
                <view class="slide"></view>
            </view>
            <view class="star_con">
                <icon :class=" item < score ? 'star_yellow' : 'star_gray'" v-for="item in 5" :key="item"></icon>
            </view>
            <view class="light_text">感谢您的反馈，我们会继续努力给您更好的服务体验</view>
        </view>
        <view class="" v-if="orderList.length>0">
            <view class="flex slide_title title_2">
                <view class="slide"></view>
                <view class="light_text">继续评价评价</view>
                <view class="slide"></view>
            </view>
            <view class="card item flex" v-for='(item,index) in orderList' :key="index">
                <image class="store_img" :src='item.store_icon'></image>
                <view class="dark_text ellipsis">{{item.store_name}}</view>
                <view class="green_bt flex" @click='goComment(item.order_no,item.store_id)'>去评价</view>
            </view>
        </view>
    </view>
</template>

<script>
    import uniFly    from 'unifly';
    import request   from '@/common/request.js';
    import $api_base from '@/api/api_base.js';
    import topNav    from '@/template/topnav/index.vue';
    import event     from '@/common/event.js';
    export default {
    	components: { topNav },
    	data() {
    		return {
    			navH: 0,
    			n: 0,
    			title:'评价成功',
                score:0,
                add_time: '',
                orderList: []
             
    		}
    	},
    	onLoad: function (options) {
    		this.navH	  = getApp().globalData.navHeight;
    		this.n		  = getApp().globalData.n;
            this.score    = options.score || 0;
            this.loadList(false);
    	},
    	methods:{
            loadList:function(isAppend){
                var where = new Object();
                var self = this;
                where.add_time = this.add_time;
                $api_base.post($api_base.getOrderList,where,1).then(function(res) {
                	let data = res.data;
                	if (data.ok == 1) {
                        var list = data.list;
                        var arr = [];
                        for(let i in list){
                            if((list[i].is_comment == 1 && list[i].is_over == 0) && list[i].status == 7){
                                arr.push(list[i])
                            }
                        }
                		if (isAppend) {
                			self.orderList = [...self.orderList, ...arr];
                		} else {
                			self.orderList = arr;
                		};
                	}
                	if (data.has_more > 0) {
                		self.add_time = data.add_time;
                	}
                });
            },
            goComment: function(id,m){
                var orderNo = id;
                var storeId = m;
                uni.navigateTo({
                    url:'/pagesOther/comment/index?order_no=' + orderNo + '&storeId=' + storeId,
                })
            },
    	},
        onPullDownRefresh: function () {
        	uni.stopPullDownRefresh();
        },
    }
</script>

<style>
  page {
    background-color: #f9f9f9;
  }
</style>
<style lang="scss" scoped>
	@import 'index.scss';
</style>
